package top.lucky.common;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;

@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
public class DistrictPojo implements Serializable {


    /**省份代码*/
    private String provinceCode;
    /**省份名称*/
    private String provinceName;
    /**城市代码*/
    private String cityCode;
    /**城市名称*/
    private String cityName;
    /**区县代码*/
    private String areaCode;
    /**区县名称*/
    private String areaName;
    /**清洗后的详细地址*/
    private String address;

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("{");
        sb.append("\"provinceCode\":\"")
                .append(provinceCode).append('\"');
        sb.append(",\"provinceName\":\"")
                .append(provinceName).append('\"');
        sb.append(",\"cityCode\":\"")
                .append(cityCode).append('\"');
        sb.append(",\"cityName\":\"")
                .append(cityName).append('\"');
        sb.append(",\"areaCode\":\"")
                .append(areaCode).append('\"');
        sb.append(",\"areaName\":\"")
                .append(areaName).append('\"');
        sb.append(",\"address\":\"")
                .append(address).append('\"');
        sb.append('}');
        return sb.toString();
    }

    @Override
    public DistrictPojo clone() {
        /**
         * 由于String对象的不可变性质，这里实现的clone是实际上深克隆
         */
        return new DistrictPojo(provinceCode, provinceName, cityCode, cityName, areaCode, areaName, null);
    }

}
